var express = require('express');
var router = express.Router();
const { uploadFiles } = require('../utils/handleFiles')

router.post('/uploadImages', function (req, res, next) {
    const images = uploadFiles({
        path: './public/temp',
        key: 'file',
        size: 10000,
    })
    images(req, res, (err) => {
        if (err) {
            console.log('图片上传失败', err);
        } else {
            console.log('图片上传成功');
            res.send({
                message: '图片上传成功',
                code: 1,
                data: req.files[0].filename
            })
        }
    })
});


module.exports = router;